{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <select name="status">
                                <option value="">状态</option>
                                <option value="1" {if !empty(input('get.status')) &&
                                    input('get.status')==1}selected{/if}>待打款</option>
                                <option value="2" {if !empty(input('get.status')) &&
                                    input('get.status')==2}selected{/if}>已打款</option>
                                <option value="3" {if !empty(input('get.status')) &&
                                    input('get.status')==2}selected{/if}>驳回打款</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="atype">
                                <option value="">类型</option>
                                <option value="1" {if !empty(input('get.atype')) && input('get.atype')==1}selected{/if}>
                                </option>
                                商家</option>
                                <option value="2" {if !empty(input('get.atype')) && input('get.atype')==2}selected{/if}>
                                    合伙人</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="shopid" lay-verify="" lay-search='' lay-filter="shopid">
                                <option value="">输入名称快速查找</option>
                                {foreach $shoplist as $v}
                                <option value="{$v.id}" {if !empty(input('get.shopid')) &&
                                    input('get.shopid')==$v.id}selected{/if}>
                                    {$v.title|default=''}(账号:{$v.account|default=''})</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="title" placeholder="用户名称|卡号" value="{:input('get.title')}"
                                autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">搜索</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    共有数据：<strong id="count">{$list->total()}</strong> 条
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>商户</th>
                                <th>金额</th>
                                <th>提现信息</th>
                                <th>状态</th>
                                <th>申请时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td>{$v.id|default=''}</td>
                                <td>{$v.shopname|default=''}</td>
                                <td>{$v.money|default=''}</td>
                                <td>
                                    姓名:{$v.name|default=''}<br />
                                    卡号:{$v.cards|default=''}<br />
                                    {switch $v.type}
                                    {case 1}银行:{$v.bank|default=''}<br />{/case}
                                    {case 2}银行:支付宝{/case}
                                    {case 3}银行:微信{/case}
                                    {default /}银行:无
                                    {/switch}
                                </td>
                                <td>
                                    {switch $v.status}
                                    {case 1}待打款{/case}
                                    {case 2}已打款{/case}
                                    {case 3}驳回{/case}
                                    {default /}无
                                    {/switch}
                                </td>
                                <td>{$v.created|default=''}</td>
                                <td class="td-manage">
                                    {switch $v.status}
                                    {case 1} <a title="打款"
                                        onclick="status_true('是否已确定打款？','/system/widthdrawstr','{$v.id}',2)"
                                        href="javascript:;" class="layui-btn layui-btn-normal">
                                        打款
                                    </a>
                                    <a title="驳回"
                                        onclick="status_true('是否已确定驳回，驳回后余额将返回？','/system/widthdrawstr','{$v.id}',3)"
                                        href="javascript:;" class="layui-btn-danger layui-btn">
                                        驳回
                                    </a>
                                    {/case}
                                    {case 2}已打款{/case}
                                    {case 3}驳回{/case}
                                    {/switch}

                                </td>

                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script>
    function status_true(title, url, id, status) {
        layer.confirm(title, function (index) {
            $.ajax({
                type: 'post',
                url: url,
                data: { id: id, status: status },
                success: function (res) {
                    if (res.code == 0) {
                        layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                            // 获得frame索引
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                }
            });
            return false;
        });
    }

    layui.use(['form', 'upload'], function () {
        var $ = layui.jquery
            , form = layui.form
            , layer = layui.layer;
    });
</script>
<script>
    layer.photos({
        photos: '#layer-photos'
        , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
</script>
{include file="public/footer"}